package components.ship;

import images.Images;

import com.uqbar.vainilla.appearances.Appearance;
import components.asteroids.Asteroid;

public class ShipRespawning extends ShipState {

	private double protection;
	
	public ShipRespawning(Ship ship){
		super(ship);
		ship.setAppearance(Images.images.getImage("ship_res").rotate(Math.toRadians(ship.getAngle() - 90)));
		this.protection = 5;
	}
	
	@Override
	public void collideWithAsteroid(Asteroid asteroid) {
		
	}

	@Override
	public void protectionTime(double delta) {
		if (this.protection - delta < 0){
			this.newState(new ShipPlaying(this.getShip()));
		}
		else{
			this.protection = this.protection -delta;
		}
	}

	@Override
	public Appearance getShipAppearance() {
		return Images.images.getImage("ship_res").rotate(Math.toRadians(this.getShip().getAngle() - 90));
	}

}
